package com.character.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.character.entity.Admin;
import com.character.entity.MyReturn;
import com.character.service.AdminService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Admin)表控制层
 *
 * @authorcc
 * @since 2021-11-29 10:13:33
 */
@RestController
@RequestMapping("admin")
public class AdminController extends BaseController {
    /**
     * 服务对象
     */
    @Resource
    private AdminService adminService;
    /**
     * 登录
     */
    @PostMapping("login")
    public MyReturn selectByNameAndPassword(@RequestBody Admin admin){

        QueryWrapper<Admin> wrapper = new QueryWrapper<>();
        wrapper.eq("name",admin.getName());
        wrapper.eq("password",admin.getPassword());
        List<Admin> list =this.adminService.list(wrapper);
        if (list.size()>0){
           return super.success(null);

        }else {
            return super.failed(null);
        }
    }


}
